<template lang="pug">
  kalix-dialog.user-add(title='修改' bizKey="histogramrequest" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="UUID" prop="uuid"  v-bind:rules="rules.uuid")
        el-input(v-model="formModel.uuid" )
      el-form-item(label="应用名称" prop="appname" v-bind:label-width="labelWidth" v-bind:rules="rules.appname")
        kalix-select(v-model="formModel.appname" v-bind:requestUrl="summaryURL" appName="summaryColumn"  placeholder="请选择应用"
        v-bind:paramObj="summaryParam" v-bind:defaultSelect="true" v-on:selectChange="setGroup" label="name")
      el-form-item(label="系统" prop="database" v-bind:label-width="labelWidth" v-bind:rules="rules.database")
        el-select(v-model="formModel.database" placeholder="请选择系统" @change="getDoctorName")
          el-option(v-for="item in filePathArr" :key="item.value" :label="item.label" :value="item.value")
</template>


<script type="text/ecmascript-6">
  import {KshHistogramrequestURL, KshSummaryURL} from '../config.toml'
  import FormModel from './model'

  export default {
    name: 'HistogramrequestEdit',
    data() {
      return {
        fileList: [],
        formModel: Object.assign({}, FormModel),
        labelWidth: '120px',
        summaryURL: KshSummaryURL,
        filePathArr: [
          {
            label: 'mysql',
            value: 'mysql'
          },
          {
            label: 'Oracle',
            value: 'Oracle'
          },
          {
            label: 'Sql',
            value: 'Sql'
          }
        ],
        rules: {
          appname: [{required: true, message: '请选择应用', trigger: 'change'}]
          // database: [{required: true, message: '请选择数据库类型', trigger: 'change'}]
          // field: [{required: true, message: '请输入纵轴名称', trigger: 'change'}]
        },
        targetURL: KshHistogramrequestURL
      }
    },
    methods: {
      getDoctorName(value) {
        this.formModel.database = value
      },
      setGroup(item) {
        this.formModel.appname = item.name
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">

</style>
